<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      main {
        width: 100%;
        margin: auto;
        padding: 59px 29px;
        border-radius: 0.3em;
        text-shadow: 0 1px 1px hsla(0, 0%, 100%, 0.3);
        box-shadow: 0 0 0 1px hsla(0, 0%, 100%, 0.3) inset,
          0 0.3em 1em rgba(0, 0, 0, 0.12);
        font: 150%/1.6 Baskerville, Palatino, serif;
      }
      main,
      main > div::before {
        background: url("./static/city-night.jpg") fixed 0 / cover;
      }
      main > div::before {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: -1;
        filter: blur(10px);
        margin: -30px;
      }
      main > div {
        font-style: italic;
        color: #000;
        padding: 30px;
        hyphens: auto;
        background: hsla(0, 0%, 100%, 0.5);
        overflow: hidden;
        position: relative;
      }
      main > div cite {
        font-style: normal;
      }
      main footer {
        text-align: right;
      }
    </style>
  </head>
  <body>
    <script>
      function assignKeyPath(obj, path, value) {
        const pathList = path.split(".");
        let assign = obj;
        while (pathList.length > 0) {
          const key = pathList.shift();
          if (pathList.length === 0) {
            assign[key] = value;
            break;
          }
          // assign[key] = assign[key] || {};
          assign =
            typeof assign[key] === "object" ? assign[key] : (assign[key] = {});
        }
        return obj;
      }

      const obj = assignKeyPath({}, "aa.bb.cc", "hello");
      const obj1 = assignKeyPath({ aa: { dd: 1 } }, "aa.bb.cc", "hello");
      const obj2 = assignKeyPath({ aa: 1 }, "aa.bb.cc", "hello");
      console.log(obj);
      console.log(obj1);
      console.log(obj2);
    </script>
  </body>
</html>
